<?php
$shop = new Shop();
$user = new User();
$shop->checkUser();//检查用户合法性，防止攻击

if(isset($_POST['submit'])){
	$province = $shop->getPlace($_POST['province'],'self');
	$city = $shop->getPlace($_POST['city'],'self');
	$area = $shop->getPlace($_POST['area'],'self');
	$data = array("create_user" => $user->getUserId("user_email"),
						  "addressee" => $_POST['true_name'],
						  "province" => $province['region_name'],
						  "city" => $city['region_name'],
						  "area" => $area['region_name'],
						  "phone_number" => $_POST['tel'],
						  "address" => $_POST['address'],
						  "zip_code" => $_POST['zip_code'],
						  "create_time" => date("Y-m-d H:i:s",time()));
	$sta = $shop->addAddress($data);
}

if(isset($_POST['del'])){
	$id = $_POST['del_id'];
	$shop->delAddress($id);
}


$address = $shop->getUseraddress();

?>